package cn.com.jinhao.hotline.commons.base.constant;

import lombok.Getter;

/**
 * hotline-spring-cloud
 * <p>Description: </p>
 *
 * @author ShaneMew
 * @version 1.0
 * @date 2019/12/26
 * @since 2019-12-26
 */

public class SystemConstant {
    /**
     * 统一返回编码
     */
    @Getter
    public enum ResponseCode {
        /**
         * SUCCESS: 成功
         * FAILED: 失败
         * USER_NOT_EXIST: 用户不存在
         * USER_PASSWORD_INCORRECT: 密码不正确
         * USER_NOT_LOGIN: 用户未登录
         * INVALID_REQUEST: 非法请求
         * SIGN_INCONSISTENT: 签名无效
         * TOKEN_TIMEOUT: token超时
         * TOKEN_INVALID: token无效
         * UNKNOWN_REQUEST: 请求类型无效
         * ACCESS_ERROR: 权限不足
         * REMOTE_ERROR: 远程调用失败
         * REP_ERROR: 重复操作
         * SERVER_EXCEPTION: 服务器异常
         */
        SUCCESS(200,"成功"),
        FAILED(100,"失败"),
        DATA_NOT_EXIST(201,"数据不存在"),
        USER_PASSWORD_INCORRECT(202,"密码不正确"),
        ACCESS_ERROR(203,"权限不足"),
        REMOTE_ERROR(204,"远程调用失败"),
        REP_ERROR(205, "重复操作"),
        USER_NOT_LOGIN(401,"用户未登录"),
        INVALID_REQUEST(402,"非法请求"),
        SIGN_INCONSISTENT(403,"签名无效"),
        TOKEN_TIMEOUT(404,"token超时"),
        TOKEN_INVALID(405,"token无效"),
        UNKNOWN_REQUEST(406,"请求类型无效"),
        SERVER_EXCEPTION(500,"服务器异常"),
        BUSINESS_EXCEPTION(999,"其它异常"),
        DUPLICATE_KEY(1001,"数据重复"),
        VALIDATION_ERROR(1002,"参数验证错误"),
        PARAM_ERROR(1003, "请求参数错误"),
        REQUEST_METHOD_ERROR(1004,"请求方式错误");


        private final int status;
        private final String name;

        ResponseCode (int status,String name) {
            this.status = status;
            this.name = name;
        }
    }


    /**
     * 系统配置常量
     */
    @Getter
    public enum SystemConfig {
        /**
         * SALT:  系统加密盐
         * CHARSET_UTF8：  系统编码
         * LOCAL_MACHINE_IP_1,LOCAL_MACHINE_IP_2,LOCAL_MACHINE_IP_3,LOCAL_MACHINE_IP_4: 本地IP
         */
        SALT("dos4gwcx"),
        CHARSET_UTF8("UTF-8"),
        POST_METHOD("POST"),
        GET_METHOD("GET"),
        LOCAL_MACHINE_IP_1("0.0.0.0"),
        LOCAL_MACHINE_IP_2("0:0:0:0:0:0:0:1"),
        LOCAL_MACHINE_IP_3("localhost"),
        LOCAL_MACHINE_IP_4("127.0.0.1");

        private final String name;

        SystemConfig (String name) {
            this.name = name;
        }

    }

    /**
     * CODE生成方式
     */
    @Getter
    public enum CodeType {
        /**
         * SIMPLE      年月日（00000）部门
         * COMPLEX     年月日时分秒(00000)部门
         */
        SIMPLE(1),COMPLEX(2);

        private final int value;

        CodeType (int value) {
            this.value = value;
        }

    }

    /**
     * 数据操作类型
     */
    @Getter
    public enum DataOperType {
        /**
         * DATA_OPER_TYPE_ADD: 增加
         * DATA_OPER_TYPE_UPDATE: 修改
         * DATA_OPER_TYPE_DEL: 删除
         */
        DATA_OPER_TYPE_ADD(1),
        DATA_OPER_TYPE_UPDATE(2),
        DATA_OPER_TYPE_DEL(3);

        private final int value;

        DataOperType (int value) {
            this.value = value;
        }

        public int getValue() {
            return value;
        }

        public static DataOperType getByValue(int value) {
            for (DataOperType dataOperType: values()) {
                if (dataOperType.getValue() == value) {
                    return dataOperType;
                }
            }
            return null;
        }
    }

    /**
     * 操作系统类型
     */
    @Getter
    public enum OSType {
        /**
         *
         */
        OS_WINDOWS("windows"),
        OS_MAC("mac"),
        OS_X11("x11"),
        OS_ANDROID("android"),
        OS_IPHONE("iphone");

        private final String name;

        OSType (String name) {
            this.name = name;
        }
    }

    /**
     * 浏览器信息
     */
    @Getter
    public enum Browse {
        /**
         *
         */
        BROWSER_TYPE_EDGE("edge"),
        BROWSER_TYPE_MSIE("msie"),
        BROWSER_TYPE_SAFARI("safari"),
        BROWSER_TYPE_CHROME("chrome"),
        BROWSER_TYPE_MOZILLA7("mozilla/7.0"),
        BROWSER_TYPE_NETSCAPE6("netscape6"),
        BROWSER_TYPE_MOZILLA47("mozilla/4.7"),
        BROWSER_TYPE_MOZILLA478("mozilla/4.78"),
        BROWSER_TYPE_MOZILLA408("mozilla/4.08"),
        BROWSER_TYPE_MOZILLA3("mozilla/3"),
        BROWSER_TYPE_FIREFOX("firefox"),
        BROWSER_VERSION("version"),
        BROWSER_OPR("opr"),
        BROWSER_OPERA("opera");

        private final String name;

        Browse (String name) {
            this.name = name;
        }
    }


    /**
     * 统计类别
     */
    @Getter
    public enum StasticType {
        /**
         *
         */
        REPORT_HOTLINE(0),
        REPORT_BOARD(1),
        REPORT_URGE_LEVEL(2),
        REPORT_SOURCE(3),
        REPORT_TYPE(4),
        REPORT_OPERATOR(5);

        private final int value;

        StasticType (int value) {
            this.value = value;
        }
    }

    /**
     * 缓存类别
     */
    @Getter
    public enum CachType {
        /**
         * CACHE_TYPE_REDIS: redis
         * CACHE_TYPE_EHCACHE: ehcache
         */
        CACHE_TYPE_REDIS("redis"),
        CACHE_TYPE_EHCACHE("ehcache");

        private final String name;

        CachType (String name) {
            this.name = name;
        }
    }


    /**
     * 事件流程状态
     */
    @Getter
    public enum FlowStatus {
        /**
         * 0    已记录事件
         * 1    待派发工单
         * 2    待接收工单
         * 3    待反馈工单
         * 4    待办结事件
         * 5    待回访事件
         * 6    撤单待审核
         * 7    同意撤单
         * 8    驳回撤单
         * 9    退单待审核
         * 10   同意退单
         * 11   驳回退单
         * 12   驳回反馈工单
         * 13   督办待审核
         * 14   同意督办
         * 15   驳回督办
         */

        UNDISPATCH("0", "已记录事件"),
        DISPATCH("1","待派发工单"),
        ACCEPT("2","待接收工单"),
        FEEDBACK("3","待反馈工单"),
        FINISH("4","待办结事件"),
        VISIT("5","待回访事件"),
        CANCELLATIONT_REVIEWED("6","撤单待审核"),
        CONSENT_CANCELLATION("7","同意撤单"),
        REJECT_CANCELLATION("8", "驳回撤单"),
        CHARGEBACK_APPROVED("9", "退单待审核"),
        AGREE_CHARGEBACK("10","同意退单"),
        REJECT_CHARGEBACK("11", "驳回退单"),
        REJECT_FEEDBACK("12", "驳回反馈工单"),
        SUPERVISION_REVIEWED("13", "督办待审核"),
        AGREE_SUPERVISE("14", "同意督办"),
        REJECT_SUPERVISOR("15", "驳回督办");
        private final String statusCode;
        private final String status;
        FlowStatus (String statusCode,String status) {
            this.statusCode = statusCode;
            this.status = status;
        }
    }

    @Getter
    public enum SysDict {
        /**
         * 任务状态
         */
        TASK_STATUS("TASK_STATUS","EVPI"),
        /**
         * 事件状态
         */
        EVENT_STATUS("EVENT_STATUS","EVIF"),
        /**
         * 事件紧急度
         */
        EVENT_URGENCY("EVENT_URGE", "UGLV"),
        /**
         * 派单方式
         */
        DISPATCH_WAY("DISPATCH_WAY", "ASWY"),
        /**
         * 呼叫转移
         */
        CALL_FORWARDING("CALL_FORWARD", "CFTP"),
        /**
         * 事件热词
         */
        EVENT_HOT_WORDS("EVENT_HOT_WORDS", "EVKW"),
        /**
         * 来电类型
         */
        CALL_TYPE("CALL_TYPE","CALL_TYPE"),
        /**
         * 门户事件类型
         */
        EVENT_TYPE_OF_PORTAL("EVENT_TYPE_OF_PORTAL", "EVLS"),
        /**
         * 系统事件类型
         */
        EVENT_TYPE_OF_SYS("EVENT_OF_SYS", "EVTP"),
        /**
         * 信息来源
         */
        INFORMATION_SOURCE("INFORMATION_SOURCE","IFOG"),
        /**
         * 回访方式
         */
        VISIT_WAY("VISIT_WAY", "NTTP"),
        /**
         * 号码类型
         */
        PHONE_TYPE("PHONE_TYPE", "PHTP"),
        /**
         * 满意度
         */
        SATISFACTION("SATISFACTION", "SATI"),
        /**
         * 撤单原因
         */
        CANCEL_REASON("CANCEL_REASON", "CANCEL_REASON"),
        /**
         * 系统设置
         */
        SYS_SETTING("SYS_SETTING",  "SYS_SETTING"),

        /**
         * 办结设置
         */
        EVENT_FINISHED_SETTING("16", "SYS_EVFS");

        private final String code;
        private final String name;

        SysDict(String code, String name) {
            this.code = code;
            this.name = name;
        }
    }


    @Getter
    public enum Operation {

        /**
         *
         */
        DISPATCH("分派"),
        FEEDBACK("反馈");

        private final String name;

        Operation(String name) {
            this.name = name;
        }
    }

    @Getter
    public enum EventType {
        /**
         * 接单
         */
        ACCEPT(1, "isAccept"),

        /**
         * 派单
         */
        DISPATCH(2,"isDispatch"),
        /**
         * 反馈
         */
        FEEDBACK(3, "isFeedback"),
        /**
         * 办结
         */
        FINISHED(4, "isFinish"),
        /**
         * 回访
         */
        VISITED(5, "isVisit"),
        /**
         * 催办
         */
        URGE(6,"isUrge"),
        /**
         * 督办
         */
        SUPERVISE(7, "isSupervise"),

        /**
         * 延期
         */
        DELAY(8, "isDelay"),
        /**
         * 超期
         */
        EXPIRED(9, "isExpire"),
        /**
         * 疑难
         */
        DIFFICULT(10, "isDifficult"),
        /**
         * 匿名
         */
        ANONYMITY(11, "isAnonymity"),
        /**
         * 归档
         */
        PIGEONHOLE(12, "isPigeonhole");


        private final int index;
        private final String name;

        EventType(int index, String name) {
            this.index = index;
            this.name = name;
        }
    }

    @Getter
    public enum FileType {
        PATH("24","上传附件地址"),
        SIZE("25","上传附件大小"),
        TYPE("26","上传附件类型");

        private final String code;
        private final String name;
        FileType(String code, String name) {
            this.code = code;
            this.name = name;
        }
    }

    @Getter
    public enum ErrorType {
        ADD_ERROR("ERROR_SYS001", "新增失败"),
        UPDATE_ERROR("ERROR_SYS002", "更新失败"),
        DELETE_ERROR("ERROR_SYS003", "删除失败"),
        REPEAT_ERROR("ERROR_REPEAT", "数据重复");

        private final String code;
        private final String name;

        ErrorType(String code, String name) {
            this.code = code;
            this.name = name;
        }
    }
}
